<script setup lang="ts">
import { ElTag } from 'element-plus'
import { computed } from 'vue'
const props = defineProps({
  tags: {
    type: Array,
    default: () => []
  },
  type: {
    type: Number,
    default: () => null
  }
})

interface optionType {
  label?: string
  type?: string
  value?: string | number | undefined
}

const option: any = computed(() => {
  const { type, tags } = props
  console.log('option', type)
  if (!!type || type === 0) {
    return tags.find((item) => item.value === type)
  } else {
    return {}
  }
})
</script>

<template>
  <ElTag :type="option.type"> {{ option.label }} </ElTag>
</template>
